#include<bits/stdc++.h>
using namespace std;
//#define int long long
signed main() {
	int n, ans;
	cin >> n;
	ans = n;
	while (n >= 3) {
		ans += n / 3;
		n = n % 3 + n / 3;
//		cout<<ans <<" "<<n<<endl;
	}
	cout << ans;
	return 0;
}
